const mongoose = require("mongoose");
const Schema = mongoose.Schema;

//个人
const user_schema = new Schema({
  username: String, //用户名
  password: String, //密码
  phone: String, //电话号码
  role: Number, //权限
  avatar: String, //头像
});

//公告
const anno_schema = new Schema({
  title: String,
  content: String,
  time: Date,
  desc: String,
  type: Number,
  author: String,
  info: Object,
});

//用户
const party_schema = new Schema({
  UserName: String,
  Sex: String,
  Age: String,
  Telephone: Number,
  Number: Number,
  Live: String,
  time: Date,
  info: Array,
});

//公告
const advise_schema = new Schema({
  title: String,
  content: String,
  time: Date,
  category: Array,
  author: String,
  info: Object,
});

//组织管理
const organize_schema = new Schema({
  number: Number, //编号
  name: String, //单位名称
  class: String, //部门
  post: String, //岗位
  duty: String, //职责
  address: String, //地址
  add: String, //补充信息
  info: Object,
});

//暴露
exports.user_model = mongoose.model("users", user_schema);
exports.anno_model = mongoose.model("annos", anno_schema);
exports.party_model = mongoose.model("partys", party_schema);
exports.advise_model = mongoose.model("advises", advise_schema);
exports.organize_model = mongoose.model("organizes", organize_schema);
